﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SysLogQuery
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            f_Date1.Value = DateTime.Today;
            f_Date2.Value = DateTime.Now;
            b_Filter_Click(sender, e);
        }


        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void b_Filter_Click(object sender, EventArgs e)
        {
            string f1 = f_SourceIP.Text.Trim();
            string f2 = f_hn.Text.Trim();
            string f3 = f_Sev.Text.Trim();
            string f4 = f_fac.Text.Trim();
            string f5 = f_hn.Text.Trim();
            string f6 = "";
            string f7 = f_msg.Text.Trim();
            DateTime fd1 = f_Date1.Value;
            DateTime fd2 = f_Date2.Value;
            if (f_Date1.Checked & f_Date2.Checked) { this.logs_vTableAdapter.Filter(this.sysLogDBDataSet1.Logs_v, f1, f2, f3, f4, f5, f6, f7, fd1, fd2); }
            if (f_Date1.Checked & !f_Date2.Checked) { this.logs_vTableAdapter.FilterNewer(this.sysLogDBDataSet1.Logs_v, f1, f2, f3, f4, f5, f6, f7, fd1); }
            if (!f_Date1.Checked & f_Date2.Checked) { this.logs_vTableAdapter.FilterOlder(this.sysLogDBDataSet1.Logs_v, f1, f2, f3, f4, f5, f6, f7, fd2); }
            if (!f_Date1.Checked & !f_Date2.Checked) { this.logs_vTableAdapter.Filternodate(this.sysLogDBDataSet1.Logs_v, f1, f2, f3, f4, f5, f6, f7); }

        }
    }
}
